const Koa = require('koa');
const app = new Koa();
const path = require('path');
const apiRouter = require('./router/index');


app.use(require('./middleware/logger')());

app.use(require('./middleware/mysql')({
    host:"localhost",
    port:"3306",
    user:"自己的名字",
    database:"自己的数据库",
    password:"自己的密码"
}));

app.use(require('koa-static')(path.join(__dirname,'./public')));

app.use(require('koa-bodyparser')());

app.use(apiRouter.routes(),apiRouter.allowedMethods());



app.listen(8080,() => {
    console.log('start network');
    console.log('http://localhost:8080')
})